﻿<%@ Page Language="C#"  MasterPageFile="~/Medianamik/MasterPages/MedianamikModule.master" AutoEventWireup="true" CodeBehind="ShopOrderEdit.aspx.cs" Inherits="Medianamik.UI.Web.Shop.ShopOrderEdit" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Medianamik.Core.Sugar" %>
<%@ Import Namespace="Medianamik.UI.Web.Shop.Data" %>
<%@ Import Namespace="Medianamik.UI.Web.Shop.Services" %>
<%@ Import Namespace="Medianamik.UI.Web.Shop.Services" %>

<asp:Content ID="ContextMenuContent" ContentPlaceHolderID="ContextMenu" runat="server">
    <asp:LinkButton ID="SaveButtonControl" runat="server" Text="<%$ Resources: Medianamik_Global, SaveButtonText %>" CssClass="Action BtSauvegarder" />
    <asp:HyperLink ID="CancelLink" runat="server" Text="<%$ Resources: Medianamik_Global, Cancel %>" CssClass="Action BtAnnuler unlock" />
</asp:Content>

<asp:Content ID="CenterContent" ContentPlaceHolderID="CenterContent" runat="server">
        <asp:ScriptManagerProxy ID="ScriptManagerProxy" runat="server" >
            <Services>
                <asp:ServiceReference Path="/Medianamik/Services/LockWebService.asmx" />
            </Services>
        </asp:ScriptManagerProxy>
        <asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
            <ContentTemplate>
 <!-- Order -->
        <p>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr><td><%="TransactionId".Translate("Shop")%>: </td> <td><%=CurrentOrder.TransactionId%></td></tr>
            <tr><td><%="PurchaseDate".Translate("Shop")%>: </td> <td><%=CurrentOrder.PurchaseDate.ToBillDate()%></td></tr>
            <tr><td><%="ShippedDate".Translate("Shop")%>: </td> <td><telerik:RadDatePicker ID="ShippedDateDatePicker" 
            SelectedDate='<%# CurrentOrder.ShippedDate %>' runat="server" /></td></tr>
            <tr><td><%="Notes".Translate("Shop")%>: </td> <td><asp:TextBox ID="NotesTextBox" runat="server" Text='<%# CurrentOrder.Notes %>' ></asp:TextBox></td></tr>
        </table>
        </p>
    
        <!-- Client -->
        <p>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr><td><%="Name".Translate("Shop")%>: </td> <td><%=CurrentClientProfile.Name%></td></tr>
            <tr><td><%="Email".Translate("Shop")%>:</td> <td><%=CurrentClientProfile.Email%></td></tr>
            <tr><td><%="Phone".Translate("Shop")%>:</td><td><%=CurrentClientProfile.PhoneNumber%></td></tr>       
       </table>
       </p>
       
       <!-- Adresses -->
       <p>
           <table cellpadding="0" cellspacing="0" border="0">
           <tr><td><%="PaymentAddress".Translate("Shop")%></td></tr>       
           <tr><td><%="Address1".Translate("Shop")%>:</td> <td><%=CurrentPaymentAddress.AddressOne%></td></tr>     
           <tr><td><%="Address2".Translate("Shop")%>:</td> <td><%=CurrentPaymentAddress.AddressTwo%></td></tr>
           <tr><td><%="State".Translate("Shop")%>:</td> <td><%=CurrentPaymentAddress%></td></tr>       
           <tr><td><%="City".Translate("Shop")%>:</td> <td><%=CurrentPaymentAddress.City%></td></tr>       
           <tr><td><%="ZipCode".Translate("Shop")%>:</td> <td><%=CurrentPaymentAddress.ZipCode%></td></tr>
       </table>
       </p>
        
      <p>
           <table cellpadding="0" cellspacing="0" border="0">
           <tr><td><%="DeliveryAddress".Translate("Shop")%></td></tr>       
           <tr><td><%="Address1".Translate("Shop")%>:</td> <td><%=CurrentDeliveryAddress.AddressOne%></td></tr>     
           <tr><td><%="Address2".Translate("Shop")%>:</td> <td><%=CurrentDeliveryAddress.AddressTwo%></td></tr>
           <tr><td><%="State".Translate("Shop")%>:</td> <td><%=CurrentDeliveryAddress%></td></tr>       
           <tr><td><%="City".Translate("Shop")%>:</td> <td><%=CurrentDeliveryAddress.City%></td></tr>       
           <tr><td><%="ZipCode".Translate("Shop")%>:</td> <td><%=CurrentDeliveryAddress.ZipCode%></td></tr>
       </table>
       </p>
     

        <!-- OrderItems -->
        <p>
        <asp:Repeater ID="_productsRepeater" runat="server" >
        <HeaderTemplate><table cellpadding="0" cellspacing="0" border="0">
            <tr><td><%= "Name".Translate("Shop") %></td><td><%= "Quantity".Translate("Shop") %></td><td><%= "Price".Translate("Shop") %></td></tr> 
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td><%# Eval("Name")%> <br />
                    <!-- Models -->
                    <asp:Repeater ID="_ModelsRepeater" DataSource='<%# Serializer.Deserialize<List<ModelDTO>>(Eval("Models").ToString()) %>' runat="server">
                        <HeaderTemplate><ul></HeaderTemplate>
                        <ItemTemplate><li><%# Eval("Name")%></li></ItemTemplate>
                        <FooterTemplate></ul></FooterTemplate>
                    </asp:Repeater>
                </td>
                <td><%# Eval("Quantity")%></td>
                <td><%# Eval("Price")%></td>
            </tr>
        </ItemTemplate>
        <FooterTemplate></table></FooterTemplate>
        </asp:Repeater>
        </p>
        
        <p>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr><td><%="SubTotal".Translate("Shop")%>:</td> <td><%=CurrentOrder.SubTotal.ToMoney()%> <%=CurrentTransactionResult.Currency%></td></tr>   
            <tr><td><%="ShippingPrice".Translate("Shop")%>:</td> <td><%=CurrentShipping.Price.ToMoney()%><%=CurrentTransactionResult.Currency%></td></tr>
            
            <!-- Taxes -->
            <asp:Repeater ID="_taxesRepeater" runat="server">
            <HeaderTemplate></HeaderTemplate>
            <ItemTemplate>
            <tr>
                <td><%# Eval("TaxName") %> (<%# Convert.ToDouble(Eval("TaxRate")) * 100 %>%)</td>
                <td><%# Eval("Tax").ToMoney() %> <%= CurrentTransactionResult.Currency%></td>
            </tr>
            </ItemTemplate>

            <FooterTemplate></FooterTemplate>
            </asp:Repeater>
            <tr><td><%="Total".Translate("Shop")%>:</td> <td><%=CurrentOrder.Total.ToMoney()%> <%=CurrentTransactionResult.Currency%></td>
        </table>
        </p>
        
        <!-- Shipping Info -->
         
        
        <!-- Payment Provider Info --> 
        <p>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr><td><%="PaymentProviderMerchantId".Translate("Shop")%></td> <td><%=CurrentTransactionResult.PaymentProviderMerchantId%></td></tr>
            <tr><td><%="AuthorisationNumber".Translate("Shop")%>:</td> <td><%=CurrentTransactionResult.AuthorisationNumber%></td></tr>
            <tr><td><%="BatchNumber".Translate("Shop")%>:</td> <td><%=CurrentTransactionResult.BatchNumber%></td></tr>
            <tr><td><%="CardType".Translate("Shop")%>:</td> <td><%=CurrentTransactionResult.CardType%></td></tr>
        </table>
        </p>
            </ContentTemplate>
        </asp:UpdatePanel>
</asp:Content>